import request from "@/utils/request";
import type { loginFormData, loginResponseData, userInfoReponseData } from './type'
// 这里面是枚举接口
enum API {
    // LOGIN_API = '/user/login',这是之前的mock接口
    //USERINFO_API = '/user/info'这是之前的mock接口

    LOGIN_URL = "/admin/acl/index/login",
    // LOGIN_URL = "http://114.115.179.162:8022/prod-api/admin/acl/index/login",
    USERINFO_URL = "/admin/acl/index/info",
    LOGOUT_URL = "/admin/acl/index/logout",
    Login_Test = '/user/login'
}

// 登录的接口

export function userLoginwsb(data: loginFormData) {
    return request<any, loginResponseData>({
        url: API.LOGIN_URL,
        method: 'post',
        data,
    })
}

// 用户信息的接口
export function userInfo() {
    return request<any, userInfoReponseData>({
        url: API.USERINFO_URL,
        method: 'get',
    })
}

// 用户退出的接口
export function reqLogout() {
    return request<any, any>({
        url: API.LOGOUT_URL,
        method: 'post',
    })
}

// 这是一个测试的登录接口
export function userTestLogin(data: any) {
    return request<any, any>({
        url: API.Login_Test,
        method: 'post',
        data,
    })
}